package com.ken.springcloud.service;

import com.ken.springcloud.pojo.Dept;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * <ul>
 * <li>Title: FeignService</li>
 * <li>Description: TODO </li>
 * </ul>
 *
 * @author swc
 * @date 2021-08-27 17:23
 */
//@FeignClient(name = "SPRINGCLOUD-PROVIDER-DEPT")
//fallbackFactory指定降级
@FeignClient(value = "SPRINGCLOUD-PROVIDER-DEPT",fallbackFactory = DeptClientServiceFallBackFactory.class)
//@FeignClient(name = "${myfeign.name}")//配置的方式也是可以的
@Component //这个注解需要加一下
public interface FeignDeptClientService {

    @GetMapping("/dept/add")
    boolean addDept(Dept dept);

    @GetMapping("/dept/get/{id}")
    Dept queryById(@PathVariable("id") Long id);

    @GetMapping("/dept/list")
    List<Dept> queryAll();
}
